﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Codemonk.EvilBox.Controls">
    <Style TargetType="{x:Type local:Widget}">
        <Setter Property="MinWidth" Value="250"/>
        <Setter Property="MinHeight" Value="180"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Icon" >
            <Setter.Value>
                <BitmapImage UriSource="/Codemonk.EvilBox.Controls;Component/Resources/Images/widget.png"/>
            </Setter.Value>
        </Setter>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border BorderThickness="{DynamicResource widgetHeaderThickness}" 
                            Background="{DynamicResource widgetHeaderBackground}"
                            BorderBrush="{DynamicResource widgetBorderBrush}">
                        <StackPanel Margin="25,1,1,1" Orientation="Horizontal">
                            <TextBlock Text="{Binding }"   HorizontalAlignment="Left" VerticalAlignment="Center"
                                   FontSize="{DynamicResource fontSize}" FontFamily="{DynamicResource fontFamily}"/>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Widget}">
                    <Border Background="{DynamicResource widgetBackgroundBrush}"
                            BorderBrush="{DynamicResource widgetBorderBrush}"
                            BorderThickness="{DynamicResource widgetBorderThickness}" 
                            CornerRadius="{DynamicResource widgetCornerRadius}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Image Source="{TemplateBinding Icon}"  HorizontalAlignment="Left" VerticalAlignment="Center" 
                                   Stretch="Uniform" Grid.RowSpan="1" Width="18" Height="18" Margin="5,1,1,1"/>
                            <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                              Content="{TemplateBinding Header}"  />
                            <ContentPresenter  Grid.Row="1" Content="{Binding Content}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>